#ifndef BAASH__H
#define BAASH__H

#include <unistd.h>
#include <string.h>
#include <sys/wait.h> 
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>

#define MAX_STR 256
#define BUFFER_SIZE 32

typedef enum{TRUE = 1, FALSE = 0} bool;
typedef enum{PIPE,INPUT,OUTPUT,NONE} operator_t ;

typedef struct{	
	char * prompt ;
	char * username;	
	char * hostname;
	char * localpath;
	char ** path;
} env_var_t;

typedef struct{ 
	char** buffer ; 
	int buffer_size ;
	operator_t op ; 
	int op_pos ; 
	int fds[2] ; 
} command_info_t ;

void perform_according_action(command_info_t*,env_var_t*) ; 
void exec_input(command_info_t*); 
void exec_output(command_info_t*) ; 
void exec_pipe(command_info_t*,env_var_t*) ; 
operator_t get_operator (char c) ;
void init_env_var ( env_var_t * v ) ;
void get_prompt(env_var_t *);
void set_path(env_var_t * );
bool parser(env_var_t *);
bool parse_command(env_var_t* , command_info_t*) ; 
char * search_cmd_dir_in_path(char* , env_var_t *) ; 
char * path_rel_to_abs(char*, char*);
void exec_command(command_info_t*,env_var_t*);
void change_dir(char *,env_var_t *);
void destroy_env_var( env_var_t * v);

#endif
